package mae.app;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
/**
 * This class is for creating and updating the Boscul Table
 * @author DJ
 *
 */
public class BosculTable {
	// Database creation SQL statement
	private static final String DATABASE_CREATE = "Create table Boscul "
			+ "(_id integer primary key autoincrement, "
			+ "SizeofWriting text not null, " + "Name text not null, "
			+ "Description text not null, " + "Value text not null, "
			+ "Status text not null);";

	/**
	 * Creation method which executes the DATABASE_CREATE string
	 * @param database // a SQLiteDatabase
	 */
	public static void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	/**
	 * Upgrade method which will drop the table Boscul if it exists
	 * and then execute the onCreate method
	 * 
	 * @param database // a SQLite database
	 * @param oldVersion // an int describing the oldVersion of the database
	 * @param newVersion // an int describing the newVersion of the database
	 */
	public static void onUpgrade(SQLiteDatabase database, int oldVersion,
			int newVersion) {
		Log.w(BosculTable.class.getName(), "Upgrading database from version "
				+ oldVersion + " to " + newVersion
				+ ", which will destroy all old data");
		database.execSQL("DROP TABLE IF EXISTS Boscul");
		onCreate(database);
	}
}